package daa.levelup.aCipher;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;


@SuppressWarnings("ThrowablePrintedToSystemOut")
public class aMain {




    public static void main(String[] args) throws UnsupportedEncodingException {


        daa.levelup.aCipher.CipherFrame cframe = new daa.levelup.aCipher.CipherFrame();
        cframe.setVisible(true);
        daa.levelup.aCipher.CipherManager Cmanager = new daa.levelup.aCipher.CipherManager();

        String alphabet = "";
        alphabet += aAlphabet.getEverything();

        String charsetName = "UTF-8";
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in, charsetName));
        try {
           // System.out.println("выберите тип кодировки: Caesar or Vizener ");
            String type = in.readLine();
            //System.out.println("Введите текст послания:");
            String text = in.readLine();
            //System.out.println("Введите величину сдвига:");
            String key = in.readLine();


            if (type.equals("Caesar")) {


                ICipher caesar = new aCaeasar(alphabet);
                String cipher = caesar.getEncryption(text, key);
                System.out.println(cipher);
                System.out.println(caesar.getDecryption(cipher, key));


            } else if (type.equals("Vizener")) {


                ICipher vizener = new aVizener(alphabet);
                String cipher = vizener.getEncryption(text, key);
                System.out.println(cipher);
                System.out.println(vizener.getDecryption(cipher, key));
            }


        } catch (Exception e) {
            System.out.println(e);
        }
    }


}
